
/**
 * rust标量基本类型
 */
pub fn rust_scalar_type() {
    let company_string = "中电信";
    let rating_float = 3.4;
    let is_good = true;
    let icon_char = '*';
    let i = 10;

    println!("string:{}", company_string);
    println!("float:{}", rating_float);
    println!("bool:{}", is_good);
    println!("char:{}", icon_char);
    println!("integer:{}", i);


    let bit:i8 = std::i8::MAX;
    let ubit:u8 = std::u8::MAX;
    let ibit16:i16 = std::i16::MAX;
    let ubit16:u16 = std::u16::MAX;
    
    //不指定默认为i32
    let ibit32 = std::i32::MAX;
    let ubit32:u32 = std::u32::MAX;

    let ibit64:i64 = std::i64::MAX;
    let ubit64:u64 = std::u64::MAX;

    let ibit128:i128 = std::i128::MAX;
    let ubit128:u128 = std::u128::MAX;

    let iarch:isize = std::isize::MAX;
    let uarch:usize = std::usize::MAX;

    println!("i8范围[{},{}]", std::i8::MIN, bit);
    println!("u8范围[{},{}]", std::u8::MIN, ubit);
    println!("i16范围[{},{}]", std::i16::MIN, ibit16);
    println!("u16范围[{},{}]", std::u16::MIN, ubit16);
    println!("i32范围[{},{}]", std::i32::MIN, ibit32);
    println!("u32范围[{},{}]", std::u32::MIN, ubit32);
    println!("i64范围[{},{}]", std::i64::MIN, ibit64);
    println!("u64范围[{},{}]", std::u64::MIN, ubit64);
    println!("i128范围[{},{}]", std::i128::MIN, ibit128);
    println!("u128范围[{},{}]", std::u128::MIN, ubit128);
    println!("isize范围[{},{}]", std::isize::MIN, iarch);
    println!("usize范围[{},{}]", std::usize::MIN, uarch);

    //单精度浮点
    let float:f32 = std::f32::MAX;
    //双精度浮点，默认
    let float64 = std::f64::MAX;

    println!("单精度浮点范围[{},{}]", std::f32::MIN, float);
    println!("双精度浮点，默认范围[{},{}]", std::f64::MIN, float64);

    //十六进制
    let mut a:u16 = 0x3f;
    //二进制
    let mut b = 0b0001_1001;
    //八进制
    let mut c = 0o745;

    
    

}    

/**
 * 复合类型
 */
pub fn rust_compound_type() {
    let mut tup:(u8,u16,u32,isize);
    tup = (3,4,5,-1);
    println!("元组第一个元素：{}", tup.0);

    let arr = [1,2,4,5];
    let arr1 = [3;4];

}